package com.neusoft.chenhanhua.d0916;

import java.awt.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;

public class Mainye {
	public static void main(String[] args) {
		t1();
	}
	public static void t1() {
		ArrayList list=new ArrayList();
		Student stu1=new Student(1, "李人", 93);
		Student stu2=new Student(5, "李2", 91);
		Student stu3=new Student(3, "李3", 96);
		Student stu4=new Student(7, "李4", 97);
		list.add(stu2);
		list.add(stu1);
		list.add(stu4);
		list.add(stu3);
//		for (int i = 0; i < list.size(); i++) {
//			System.out.println(list.get(i));
//		}
		Iterator iterator =list.iterator();
		while (iterator.hasNext()) {
			System.out.println(iterator.next());
			
		}
		//System.out.println("比较之后");
//		Collections.sort(list, new Comparator() {
//			@Override
//			public int compare(list o1,list o2,List o3) {
//				return  o3.name.compareTo(o3.name);
//			}
//		});
//		Object[] str=list.toArray();
//		java.util.Arrays.sort(str);
//		for (int i = 0; i < str.length; i++) {
//			System.out.println(str[i]);
//		}
	}
}
